package com.shengde.jinwawaforleader.model.personalCenter.activity;

import android.app.Dialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.shengde.jinwawaforleader.R;
import com.shengde.jinwawaforleader.base.BaseActivity;

public class AboutUs extends BaseActivity {
    private TextView tv_back;
    private TextView tv_title;
    private RelativeLayout rl_bangzhu;
    private RelativeLayout rl_fankui;
    @Override
    public void onRoot(Bundle savedInstanceState) {
        setContentView(R.layout.activity_about_us);
    }

    @Override
    public void initView() {
        tv_back = (TextView)findViewById(R.id.tv_back);
        tv_title = (TextView)findViewById(R.id.tv_title);
        rl_bangzhu = (RelativeLayout)findViewById(R.id.rl_bangzhu);
        rl_fankui = (RelativeLayout)findViewById(R.id.rl_fankui);
    }

    @Override
    public void initData() {
        tv_title.setText("关于我们");
    }

    @Override
    public void initListener() {
        tv_back.setOnClickListener(this);
        rl_bangzhu.setOnClickListener(this);
        rl_fankui.setOnClickListener(this);
    }

    @Override
    public void onWidgetClick(View view) {
        switch (view.getId()) {
            case  R.id.tv_back://返回
                finish();
                break;
            case R.id.rl_bangzhu://电话
                final String phone = "075523118484";
                final Dialog dialog = new Dialog(this, R.style.dialog);
                View contentView = LayoutInflater.from(this).inflate(
                        R.layout.dialog_exit, null);
                dialog.setContentView(contentView);
                dialog.setCanceledOnTouchOutside(true);
                dialog.show();
                TextView ok = (TextView) contentView.findViewById(R.id.button_ok);
                TextView textView1990 = (TextView) contentView.findViewById(R.id.textView1990);
                textView1990.setText("您确定要拨打电话么?");
                TextView cacel = (TextView) contentView.findViewById(R.id.button_cacel);
                ok.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(Intent.ACTION_DIAL);
                        intent.setData(Uri.parse("tel:" + phone));
                        startActivity(intent);
                        dialog.dismiss();
                    }
                });
                cacel.setOnClickListener(new View.OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        // TODO Auto-generated method stub
                        dialog.dismiss();
                    }
                });
                break;
            case R.id.rl_fankui:
                Intent data=new Intent(Intent.ACTION_SENDTO);
                data.setData(Uri.parse("mailto:2778961756@qq.com"));
                data.putExtra(Intent.EXTRA_SUBJECT, "问题反馈");
                data.putExtra(Intent.EXTRA_TEXT, "请输入要反馈的内容...");
                startActivity(data);
                break;
        }
    }
}
